#ifndef LONGKEY_IM_LIST_NODE_H_
#define LONGKEY_IM_LIST_NODE_H_

#include <math.h>

namespace DuiLib
{
	struct NodeData 
	{
		int level_;
		bool folder_;
		bool child_visible_;
		bool has_child_;
		TString text_;
		TString value_;
		CListContainerElementUI* list_element_;
	};

	double CalculateDelay(double state);

	class UIListNode
	{
	public:
		UIListNode();
		explicit UIListNode(NodeData t);
		UIListNode(NodeData t, UIListNode* parent);
		~UIListNode();

		NodeData& GetData();

		int GetChildrenCount() const;

		UIListNode* GetParent();
		UIListNode* GetChild(int index);
		UIListNode* GetLastChild();

		bool folder() const;
		bool HasChildren() const;

		void AddChild(UIListNode* child);
		void RemoveChild(UIListNode* child);

	private:
		void SetParent(UIListNode* parent);

		typedef std::vector<UIListNode*> Children;

		Children children_;
		UIListNode* parent_;

		NodeData data_;
	};
}

#endif	// LONGKEY_IM_LIST_NODE_H_
